package demo09_BlockingQueue;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author kunkun
 * @className Test02_Return
 * @Description
 * @date 2025/3/6 13:54
 */
public class Test02_Return {

    public static void main(String[] args) {
        ArrayBlockingQueue<Object> queue = new ArrayBlockingQueue<>(2);

        //1. 新增
        System.out.println(queue.offer("a"));
        System.out.println(queue.offer("b"));
        System.out.println(queue.offer("c")); //队列已满，返回false

        //2. 读取
        System.out.println(queue.peek());

        //3. 移除
        queue.poll();
        queue.poll();
        System.out.println(queue.poll());    //队空返回null

        //4. 读取
        System.out.println(queue.peek());    //队空返回null
    }




}
